_require "./SQLPrim.smi"
_require "./SQLErrors.smi"
_require "./Backend.smi"
_require "./builtintypes/timestamp/TimeStamp.smi"

structure SQL =
struct

  structure TimeStamp = SMLSharp_SQL_TimeStamp

  type bool3 = SMLSharp_SQL_Prim.bool3
  type timestamp = SMLSharp_SQL_Prim.timestamp
  type numeric = SMLSharp_SQL_Prim.numeric
  type decimal = numeric
  type backend = SMLSharp_SQL_Prim.backend
  type 'a server = 'a SMLSharp_SQL_Prim.server
  type 'a conn = 'a SMLSharp_SQL_Prim.conn
  type 'a cursor = 'a SMLSharp_SQL_Prim.cursor
  type ('toy,'w) exp = ('toy,'w) SMLSharp_SQL_Prim.exp
  type ('toy,'w) whr = ('toy,'w) SMLSharp_SQL_Prim.whr
  type ('toy,'w) from = ('toy,'w) SMLSharp_SQL_Prim.from
  type ('toy,'w) orderby = ('toy,'w) SMLSharp_SQL_Prim.orderby
  type ('src,'toy,'w) select = ('src,'toy,'w) SMLSharp_SQL_Prim.select
  type ('toy,'w) query = ('toy,'w) SMLSharp_SQL_Prim.query
  type ('toy,'w) command = ('toy,'w) SMLSharp_SQL_Prim.command
  type ('toy,'w) db = ('toy,'w) SMLSharp_SQL_Prim.db
  exception Format = SMLSharp_SQL_Errors.Format
  exception Exec = SMLSharp_SQL_Errors.Exec
  exception Connect = SMLSharp_SQL_Errors.Connect
  exception Link = SMLSharp_SQL_Errors.Link

  val postgresql = SMLSharp_SQL_Backend.postgresql
  val mysql = SMLSharp_SQL_Backend.mysql
  val odbc = SMLSharp_SQL_Backend.odbc
  val sqlite3 = SMLSharp_SQL_Backend.sqlite3
  val sqlite3' = SMLSharp_SQL_Backend.sqlite3'
  structure SQLite3 = SMLSharp_SQL_Backend.SQLite3

  val queryCommand = SMLSharp_SQL_Prim.queryCommand
  val connect = SMLSharp_SQL_Prim.connect
  val connectAndCreate = SMLSharp_SQL_Prim.connectAndCreate
  val closeConn = SMLSharp_SQL_Prim.closeConn
  val closeCursor = SMLSharp_SQL_Prim.closeCursor
  val fetch = SMLSharp_SQL_Prim.fetch
  val fetchAll = SMLSharp_SQL_Prim.fetchAll

  val toy = SMLSharp_SQL_Prim.toy
  val commandToString = SMLSharp_SQL_Prim.commandToString
  val queryToString = SMLSharp_SQL_Prim.queryToString
  val expToString = SMLSharp_SQL_Prim.expToString

  structure Numeric = SMLSharp_SQL_Prim.Numeric
  structure Decimal = Numeric
  structure Op = SMLSharp_SQL_Prim.Op

end
